package com.fage.swing;

import javax.swing.*;
import java.awt.*;

/**
 * @author lin
 * @version 1.0
 * @date 2020-08-31 16:31
 * @Description TODO
 */
public class FrameMain1 {
    boolean status;
    Component glassPane;
    TextArea textArea;

    public static void main(String[] args) {
        new FrameMain1().init();
    }

    private void init() {
        JFrame jFrame = new JFrame("FrameMain1");
        // 设置 可见性
        jFrame.setVisible(true);
        jFrame.setBackground(Color.BLUE);
        jFrame.setBounds(377, 377, 277, 277);

        glassPane = jFrame.getGlassPane();

        Container c1 = jFrame.getContentPane();
        c1.setLayout(null);

        textArea = new TextArea();
        textArea.setBounds(15, 125, 100, 100);
        textArea.append("status:" + status);
        status = true;
        textArea.invalidate();
        c1.add(textArea);


        Button button = new Button("open new frame");
        button.setBounds(15, 15, 100, 100);
        button.addActionListener(e -> {
            new FrameMain2(this).init();
        });
        c1.add(button);

        // 关闭事件
        jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    }

}
